General information
Touhou Toolkit (or thtk for short) is a tool for unpacking and modifying Touhou game resource files. It allows to extract and modify game sprites, textures and GUI elements; in-game texts; level scripts that specify enemy movements, attacks, etc.; demo-replays and in-game sounds. It does not allow to work with music (except for midi music in games 6-8) and save files.
Touhou Toolkit consists of four console applications: thdat handles the main dat-files, thanm processes graphics, thmsg — dialogues, thecl — scripts. The current version completely supports all danmaku Touhou games from 6 to 13. thdat is also able to process dat-files for PC-98 games, but the resulting files (other than plain txt) are not processable by thtk. The program can also work with doujin games if their file format is compatible with one of Touhou formats. However, a warning will be given if dat-file name is different from Touhou dat-file name.
Touhou Toolkit is a console application and this program provides a graphical user interface for it. First thing you should do is specify the path to your thtk folder. You may also provide a path to the folder where all your Touhou games reside. The latest version may be downloaded from a repository at Google Code. The archive also includes more detailed manuals for each of the applications.
THDAT
First stage of working with thtk is unpacking the main dat-file of the game. Choose the game in the main menu. Specify a target folder in the field "Folder". Specify the main dat-file (its name usually follows the pattern th№(e).dat. Files such as thbgm.dat and score.dat cannot be processed by thdat. In EoSD game content is spread over six files, which contain:
CM — bullet sprites and playable character pictures and mini-sprites
ED — texts and images from endings and credits
IN — sounds and interface elements
MD — midi-music
ST — attack scripts, backgrounds for levels and spellcards, enemy and boss sprites and pictures, dialogue texts
TL — menu images and texts.
«Extract archive» extracts the dat-file into the target folder.
«List files» generates a txt file containg list of files in the archive and places it to \lists subdirectory of the program's directory. This list is used during cretion of the archive and changing its contents will almost certainly make the dat-file unusable. The list is also created automatically during archive extraction.
«Create archive from folder» packs the contents of the working folder into a dat-file. If the target dat-file already exists, it will be renamed before the process (will get additional extension, .bkp№) if «Make backup» option is set. Otherwise, it will be replaced.
All files contained in the dat-file will be placed in the target directory. Some of them, such as demo-replays, pictures and sounds, may be accessed directly. anm-, ecl- and msg-files should be further processed by thtk applications.
THANM
Files with .anm extension contain game graphics in PNG format, as well as scripts describing its behavior. Unpacking and packing process of these files are similar to dat-files, with two differences:
The program automatically generates a suggested target folder matching the name of anm-file. Files inside the anm archive are organized in folder structure which is reproduced in the target folder during the unpacking process. Changing folders' names or structure will make the anm-file unusable.
Archive creation process uses not a simple file list, but a special txt file called "description". It is created upon unpacking, but can also be generated using «Get description» button. The suggested name for the description file is generated automatically.
thanm also provides a method to replace a single picture within the archive without repacking. Specify a picture to replace in the «Entry» field (use the «...» button; you will need to generate a desription file first), then specify a replacement file in the «File» field and press «Replace file in archive».
THMSG
msg-files contain dialogues. Those files may be named *.msg (for newer games) or msg*.dat (for older ones). Each of them unpacks into a single txt file (encoded in Shift JIS for Japanese version and ASCII for English). «Extract archive to file» unpacks the specified «Archive» into the specified «File», and «Create archive from file» performs the opposite. The program automatically generates a suggested target file name matching the name of msg-file.
THECL
ecl-files contain
scripts which describe the enemy movements, attacks, etc.
Their structure and handling is analogous to msg-files. The thtk page on
GoogleCode has an incomplete description
of the script language used in these files.
Known issues These bugs are caused by thtk itself, not GUI:
There is a problem with english version of PoFV.
Upon unpacking the console shows some errors and some
of the files are not unpacked properly. The archive created
from these files is unusable. This issue does not affect
japanese version.
. There is a known bug that affects creation of ecl-files.
It causes the application to throw a syntax error and irreversably corrupts the
target ecl-file. The bug is caused by the application improperly handling
escaped double quotes (symbols \") which are used in spellcards' names. To fix this
error you will need to replace all instances of \" in the source file
to any other symbol or combination of symbols (except for ")